package com.yyg.usecase.springbootwebdemo.web;

import com.yyg.usecase.springbootwebdemo.service.starter_demo.AuthServiceWrap;
import com.yyg.usecase.springbootwebdemo.service.starter_demo.VipServiceWrap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class ServiceByStarterControllerTest {

    @Autowired
    private AuthServiceWrap authServiceWrap;

    @Autowired
    private VipServiceWrap vipServiceWrap;

    @RequestMapping(value = "/user/{userId}", method = RequestMethod.GET)
    @ResponseBody
    public String getUserInfo(@PathVariable("userId") String userId) {
        return "User Id : " + userId + " Role : " + authServiceWrap.isAdmin(userId);
    }

    @RequestMapping(value = "/vip/{userId}", method = RequestMethod.GET)
    @ResponseBody
    public String getVIpInfo(@PathVariable("userId") String userId) {
        return "User Id : " + userId + " vip : " + vipServiceWrap.getVipDesc(userId);
    }

}
